﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
namespace FubiManger.UI
{
    partial class AplaycodeForm : Smobiler.Core.Controls.MobileForm
    {
        public AplaycodeForm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }
        /// <summary>
        /// 支付宝收款码
        /// </summary>
        public string aplycode { get; set; }
        /// <summary>
        /// 商户ID
        /// </summary>
        public string mid { get; set; }
        private void panclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }

        private void camera1_ImageCaptured(object sender, BinaryResultArgs e)
        {
            if (e.Data != null && e.isError == false)
            {
                string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
                e.SaveFile(filename, @"C:\paycode\");
                imgcode.ResourceID = @"C:\paycode\" + filename;
                aplycode = filename;
            }
        }

        private void btncode_Press(object sender, EventArgs e)
        {
            camera1.GetPhoto();
        }

        private void AplaycodeForm_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(aplycode))
                imgcode.ResourceID = @"C:\paycode\" + aplycode;
        }

        private void btnsave_Press(object sender, EventArgs e)
        {
            merchantDal.Updatealpaycode(aplycode, mid);
            this.Close();
        }
    }
}